<!DOCTYPE html>
<html>
	<!--
    	作者：510669408@qq.com
    	时间：2017-10-16
    	描述：启动主页 加载其他子页面 包括 商品展示也  设置 反馈等
    -->

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<title></title>
		<script src="js/mui.min.js"></script>
		<script src="js/jquery-1.11.0.js"></script>
		<script src="js/checkVN.js"></script>
		<script src="js/loaddata.js"></script>
		<script src="js/location.js"></script>
		<script src="js/GetCallRecord.js"></script>
		<link href="css/mui.min.css" rel="stylesheet" />
		<link href="css/maytao.css" rel="stylesheet" />

	</head>

	<body>
		<div class="mui-bar mui-bar-nav" style=" background-color: #95c32f;display:block;position:fixed; z-index:999; top:0;">
			<div class="header"> 寐淘 ● 实时同步折扣信息
				<a href="javascript:mui.openWindow({url: 'search.html',id: 'info'});" style="color: #F0F0F0;"><span class="mui-icon mui-icon-search" style="position: absolute;right: 3%;top: 5%;"></span>
				</a>
			</div>
		</div>
		<!--	<div id="progress">
			<p>下载中</p>
				 <progress value="0" max="100" id="proDownFile"></progress>
					<p id="jindu"></p>
		</div>-->
		<div id="middlePopover" class="mui-popover">
			<div class="mui-popover-arrow"></div>
			<div class="mui-scroll-wrapper" style="top:-227px;width: 43%;left: 30%;">
				<div class="mui-scroll" style="text-align: center;">
					<ul class="mui-table-view">
						<li class="mui-table-view-cell">
							<a href="#" onclick="Tomiaosha(1)">天猫秒杀</a>
						</li>
						<li class="mui-table-view-cell">
							<a href="#" onclick="Tomiaosha(2)">京东秒杀</a>
						</li>
						<li class="mui-table-view-cell">
							<a href="#" onclick="Tomiaosha(3)">当当秒杀</a>
						</li>
						<li class="mui-table-view-cell">
							<a href="#" onclick="Tomiaosha(4)">国美秒杀</a>
						</li>
						<!--<li class="mui-table-view-cell"><a href="#" onclick="Tomiaosha(5)">1号店秒杀</a>
						</li>-->
						<li class="mui-table-view-cell">
							<a href="#" onclick="Tomiaosha(6)">苏宁秒杀</a>
						</li>

					</ul>
				</div>
			</div>

		</div>
		<!--
  	作者：510669408@qq.com
  	时间：2017-10-11
  	描述：底部導航
  -->
		<nav class="mui-bar mui-bar-tab">

			<a id="defaultTab" class="mui-tab-item mui-active" href="index.html">
				<span class="mui-icon mui-icon-home"><span class="mui-badge"style="display: none;"  id="sphome"></span></span>
				<span class="mui-tab-label">折扣精选</span>
			</a>
			<a id="miaosha" class="mui-tab-item " style="text-align: center;" href="#" onclick="openMiaosha()">

				<img src="imgs/ms.png" style="width: 26px;height:26px;margin-bottom: -10px; margin-top: 1px;"><br/>
				<label style="font-size: 11px;"> 秒杀</label>
			</a>
			<a id="category" class="mui-tab-item" href="#">
				<img src="imgs/catergry.png" style="width: 70px;height:48px; margin-top: 1px;"></img>

			</a>
			<a id="settings" class="mui-tab-item" href="setting.html">
				<span class="mui-icon mui-icon-gear"><span class="mui-badge"style="display: none;"  id="spset">1</span></span>
				<span class="mui-tab-label">设置</span>
			</a>

		</nav>
	</body>
	<script type="text/javascript" charset="utf-8">
		//mui初始化
		mui.init();

		function openMiaosha() {

			mui.openWindow({
				url: 'miaosha.html',
				id: 'miaosha'
			})
		}

		//秒杀弹出
		function Tomiaosha(obj) {
			var msurl = "";
			var title = ""
			if(obj == 1) {

			} else if(obj == 2) {
				msutl = "https://0410c.duomai.com/track.php?k=0MlMHc0RHa9QnJvFGd5FWb9QWa1VmJxYTPklWYmgTN5cjMy0DZp9VZ0l2cmYCdzlGTsxWarNWZzZkMlwGbpt2YlNnRyUSbvNmLkpmLt5yctZkMlYkMlE"
				title = "京东秒杀"
			} else if(obj == 3) {
				title = "当当秒杀"
				msurl = "https://0410c.duomai.com/track.php?k=zUCc0RHa9QnJvFGd5FWb9QWa1VmJ0YTPklWYmgTN5cjMy0DZp9VZ0l2cmAHaw5Cbsl2ajV2cGJTJt92YucmbhR2ZuFGZu0mLoNWdvRnRyUiRyUSQ"
			} else if(obj == 4) {
				title = "国美秒杀"
				msurl = "https://0410c.duomai.com/track.php?k=0ZybhRXeh1WPklWdlZiNzITPklWYmgTN5cjMy0DZp9VZ0l2cmYiJGJTJuNmLt92YuUWbvdmLt5ScGJTJGJTJBNTJzBHd0hWP"
			}
			/*else if(obj==5)
			{
				
			}*/
			else if(obj == 6) {
				title = "苏宁秒杀"
				msurl = "https://0410c.duomai.com/track.php?k=qZkMlYkMlE0MlMHc0RHa9QnJvFGd5FWb9QWa1VmJ0gTPklWYmgTN5cjMy0DZp9VZ0l2cm0Gdo5CMfBzX0lmbJJXZ0V3bGJTJi9mctxWYwZkMlAXY3ZkMl02bj5yZulmb1NnLt5Sd"
			}
			mui.plusReady(function() {
				plus.storage.setItem("msurl", msurl);
				plus.storage.setItem("mstitle", title);
				mui.openWindow({
					url: 'miaosha.html',
					id: 'miaosha'
				})
			});

		}

		$(document).ready(function() {
			navEvent();
			workToGetNewData()
			CheckVN(0);
			//getDeviceInfo()
			getGeocode()
			GetUuid()
		})

		window.addEventListener("HideNotice", function(e) {
			$("#sphome").css("display", "none");
			$("#sphome").html("0")
		});
		//获取设备信息
		function getDeviceInfo() {
			/*mui.plusReady(function() {
				console.log(plus.device.uuid);

			}); */
		}

		var subpages = ['index.html', 'setting.html'];
		var subpage_style = {
			top: '45px',
			bottom: '51px'
		};
		var aniShow = {};

		//创建子页面，首个选项卡页面显示，其它均隐藏；
		mui.plusReady(function() {
			var self = plus.webview.currentWebview();
			for(var i = 0; i < 2; i++) {

				var temp = {};
				var sub = plus.webview.create(subpages[i], subpages[i], subpage_style);
				if(i > 0) {
					sub.hide();
				} else {
					temp[subpages[i]] = "true";
					mui.extend(aniShow, temp);
				}
				self.append(sub);
			}
		});
		//当前激活选项
		var activeTab = subpages[0];
		//var title = document.getElementById("title");
		//选项卡点击事件
		function tabStartTouch(obj) {

			var targetTab = obj.getAttribute('href');
			if(targetTab == activeTab) {
				return;
			}
			//更换标题
			//title.innerHTML = obj.querySelector('.mui-tab-label').innerHTML;
			//显示目标选项卡
			//若为iOS平台或非首次显示，则直接显示
			if(mui.os.ios || aniShow[targetTab]) {
				plus.webview.show(targetTab);
			} else {
				//否则，使用fade-in动画，且保存变量
				var temp = {};
				temp[targetTab] = "true";
				mui.extend(aniShow, temp);
				plus.webview.show(targetTab, "fade-in", 300);
			}
			//隐藏当前;
			plus.webview.hide(activeTab);
			//更改当前活跃的选项卡
			activeTab = targetTab;
		}
		//自定义事件，模拟点击“首页选项卡”
		document.addEventListener('gohome', function() {
			var defaultTab = document.getElementById("defaultTab");
			//模拟首页点击
			mui.trigger(defaultTab, 'tap');
			//切换选项卡高亮
			var current = document.querySelector(".mui-bar-tab>.mui-tab-item.mui-active");
			if(defaultTab !== current) {
				current.classList.remove('mui-active');
				defaultTab.classList.add('mui-active');
			}
		});

		//增加 touchstart 事件 阻止click事件
		function navEvent() {
			var nav = document.getElementById("defaultTab")
			if(nav != null) {
				nav.addEventListener("touchstart", function(e) {
					e.preventDefault();
					tabStartTouch(nav)
					homeTouch();
				});
				var settings = document.getElementById("settings")
				settings.addEventListener("touchstart", function(e) {
					e.preventDefault();
					tabStartTouch(settings)

				});
				var cate = document.getElementById("category")
				cate.addEventListener("touchstart", function(e) {
					e.preventDefault();
					openCate();

				});
				var ms = document.getElementById("miaosha")
				ms.addEventListener("touchstart", function(e) {
					e.preventDefault();
                       openMs() 
				});
			}

		}
		//秒杀频道
		function openMs() {
			mui.openWindow({
				url: 'miaosha.html',
				id: 'miaosha'
			})
		}
		//分类查询
		function openCate() {
			mui.openWindow({
				url: 'tySearch.html',
				id: 'info1'
			})
		}
	</script>

</html>